<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>箭头函数</title>
    <script>
      let list = [10, 20, 30];
      //   es 5
      let newlist = list.map(function (val, index) {
        return val * val;
      });

      console.log(newlist); //[100, 400, 900]
      // es 6
      newlist = list.map((val, index) => {
        return val * val;
      });
      console.log(newlist); //[100, 400, 900]
      newlist = list.map((val) => {
        return val * val;
      });
      console.log(newlist); //[100, 400, 900]
      //注意点：没有 this、super、arguments 和 new.target 绑定。
    </script>
  </head>
  <body></body>
</html>
